# -*- coding:utf-8 -*-
import os
import pathlib
from common.data import DB
import json

ABSPATH = pathlib.Path(__file__).resolve().parent.parent


def read_case():
    case_path = os.path.join(ABSPATH, DB.DirName, DB.case_task_name, "case.json")

    with open(case_path, 'r', encoding='utf-8') as f:
        text = f.read()
    return json.loads(text)


def write_case(caseData):
    case_path = os.path.join(ABSPATH, DB.DirName, DB.case_task_name, "case.json")

    with open(case_path, 'w', encoding='utf-8') as f:
        f.write(json.dumps(caseData))
